#include "MQTTPublisher.h"
#include <chrono>
#include <thread>

int main() {
  MQTTPublisher pub("192.168.5.11", "vm_publisher", "test/topic", 1);

  if (!pub.connect())
    return 1;
  pub.loop_start();

  for (int i = 1; i <= 10; ++i) {
    pub.publish("Hello MQTT with auto-reconnect " + std::to_string(i));
    std::this_thread::sleep_for(std::chrono::seconds(1));
  }

  pub.loop_stop();
  pub.disconnect();
  return 0;
}
